Strict

Import agfx

Global myTmpScreen:TTmpScreen

Class TAgfx_test_app Extends TFramework

	Method OnCreate:Int()
		
		Super.OnCreate()
				
		myTmpScreen = New TTmpScreen		
		myTmpScreen.Prepare()
		
		Return 0
	End

	
End


Class TTmpScreen Extends TScreen
	
	Field fileHandler:TFileSystem

	' START when app is created
	Method Start:Void()
		Self.fileHandler = TFileSystem.Create()
	    
	    Local stream:TFileStream
	    Local n:int
	    stream = Self.fileHandler.WriteFile("test/test.bin")
	    stream.WriteString("Hello")
	    stream.WriteInt(1234343)
	    stream.WriteString("Bye!")
	    
	    stream = Self.fileHandler.WriteFile("anotherfile.dat")
	    stream.WriteFloat(1.234)
	
	    Self.fileHandler.SaveAll()
	    Self.fileHandler.ListDir()
	    
	    stream = Self.fileHandler.ReadFile("test/test.bin")
	    if stream
	      Print stream.ReadString()
	      Print stream.ReadInt()
	      Print stream.ReadString()
	    EndIf

	End
	
	' main app logic loop update
	Method Update:Void()
	
	End
	
	' main app render loop
	Method Render:Void()
		Cls
	
	End
End
